﻿package kizzo.utils 
{
	import fl.motion.Tweenables;
	import flash.display.DisplayObject;
	import fl.motion.easing.Quadratic;
	import kizzo.utils.BaseTweener;
	
	public class ZoomTweener extends BaseTweener
	{
		private var x_start:Number;
		private var x_translation:Number;
		
		private var y_start:Number;
		private var y_translation:Number;
		
		private var zoom_start:Number;
		private var zoom_factor:Number;
		
		private var image:DisplayObject;
		
		public function ZoomTweener(x_translation:Number, y_translation:Number, zoom_factor:Number, image:DisplayObject, steps:uint) 
		{
			this.x_start = image.x;
			this.x_translation = x_translation;
			
			this.y_start = image.y;
			this.y_translation = y_translation;
			
			this.zoom_start = 1.0;
			this.zoom_factor = zoom_factor;
			
			this.image = image;
			super(steps);
		}
		
		
		override protected function init():void
		{		

		}
		
		
		override protected function set_current(step:uint):void
		{
			this.image.x = Quadratic.easeInOut(step, x_start, x_translation, this.steps);
			this.image.y = Quadratic.easeInOut(step, y_start, y_translation, this.steps);
			this.image.scaleX = this.image.scaleY = Quadratic.easeInOut(step, zoom_start, zoom_factor, this.steps);			 
		}	
		
	}
	
}